
import axios from "../utils/axios";

const rolecont = async (page: number, limit: number, name: string) => {
    const data = await axios({
        url: 'role/list',
        method: 'post',
        data: {
            page: page,
            limit: limit,
            name:name
        }
    })

    return data;
}
// 添加
const addRolecont = async (_data: {
    name: string
    description: string
    menuIds: Array<number>
}) => {
    const data = await axios({
        url: 'role/add',
        method: 'post',
        data:_data
    })
    return data
}
// 编辑
const editRolecont = async (_data: {
     id: number
    name: string
    description: string
    menuIds: Array<number>
}) => {
    const data = await axios({
        url: 'role/update',
        method: 'post',
        data:_data
    })
    return data
}
//删除
const deteRolecont = async (id: number)=>{
    const data = await axios({
        url: 'role/deleteById',
        method: 'get',
        params: {
            id:id
        } 
    })
    return data
}

export {
    rolecont,
    addRolecont,
    editRolecont,
    deteRolecont
}